package com.wicket.okrframework.web.contorller;

import com.github.pagehelper.Page;
import com.wicket.okrframework.biz.service.StatisticalDataService;
import com.wicket.okrframework.biz.service.dto.req.QueryPostStaffingStatisticsListReqDto;
import com.wicket.okrframework.biz.service.dto.res.QueryPostStaffingStatisticsListRespDto;
import com.wicket.okrframework.common.ro.OkrResult;
import com.wicket.okrframework.common.util.CommonFunctionHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ：
 * @date ：
 *
 *
 * @version 1.0
 */
@RestController
@RequestMapping("/base/statisticalData/")
public class StatisticalDataController {

    @Autowired
    StatisticalDataService statisticalDataService;

    /**
   * D1-3查询编制统计（边界）
   */
    @PostMapping("queryPostStaffingStatisticsList")
    public OkrResult<QueryPostStaffingStatisticsListRespDto> queryPostStaffingStatisticsList(@RequestBody @Validated QueryPostStaffingStatisticsListReqDto reqDTO){
    Page<?> page = CommonFunctionHelper.startPage(reqDTO.getPageNum(),reqDTO.getPageSize());

        QueryPostStaffingStatisticsListRespDto retData = statisticalDataService.queryPostStaffingStatisticsList(reqDTO);

        retData.setPageNum(page.getPageNum());
        retData.setPageSize(page.getPageSize());
        retData.setTotalNum(page.getTotal());
        return OkrResult.success(retData);
    
    }
}
